<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/themes/blue/pace-theme-minimal.min.css">
  <script src="//cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js"></script>

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"zhangyh.fun","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":"default"},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="Nginx 介绍及使用">
<meta property="og:type" content="article">
<meta property="og:title" content="Nginx 介绍及使用">
<meta property="og:url" content="https://zhangyh.fun/2021/08/26/Nginx%20%E4%BB%8B%E7%BB%8D/index.html">
<meta property="og:site_name" content="XiaoPang の Blog">
<meta property="og:description" content="Nginx 介绍及使用">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-08-26T01:40:00.000Z">
<meta property="article:modified_time" content="2021-08-27T01:59:42.702Z">
<meta property="article:author" content="XiaoPang">
<meta property="article:tag" content="nginx1">
<meta name="twitter:card" content="summary">

<link rel="canonical" href="https://zhangyh.fun/2021/08/26/Nginx%20%E4%BB%8B%E7%BB%8D/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>Nginx 介绍及使用 | XiaoPang の Blog</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

  <script>
  var _hmt = _hmt || [];
  (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?54b35e78bac318b678b24fbb33049203";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
  </script>


</head>

<body itemscope itemtype="http://schema.org/WebPage">

  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">XiaoPang の Blog</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
    <script src="https://v1.hitokoto.cn/?c=f&encode=js&select=%23hitokoto" defer></script>

      <p class="site-subtitle" itemprop="description" id="hitokoto"><span id="hitokoto_text">记录生活中的点点滴滴</span></p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">19</span></a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">11</span></a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">34</span></a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://zhangyh.fun/2021/08/26/Nginx%20%E4%BB%8B%E7%BB%8D/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="XiaoPang">
      <meta itemprop="description" content="少说，多做">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="XiaoPang の Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Nginx 介绍及使用
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于：</span>

              <time title="创建时间：2021-08-26 09:40:00" itemprop="dateCreated datePublished" datetime="2021-08-26T09:40:00+08:00">2021-08-26</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于：</span>
                <time title="修改时间：2021-08-27 09:59:42" itemprop="dateModified" datetime="2021-08-27T09:59:42+08:00">2021-08-27</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/nginx/" itemprop="url" rel="index"><span itemprop="name">nginx</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="leancloud-visitors-count"></span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
            <br>
            <span class="post-meta-item" title="本文字数">
            <span class="post-meta-item-icon">
            <i class="fa fa-file-word"></i>
            </span>
           <span class="post-meta-item-text">本文字数：</span>
           <span title="post.wordcount">
                2.6k 字
            </span>
            </span>
            <span class="post-meta-item" title="阅读时长">
            <span class="post-meta-item-icon">
            <i class="fa fa-clock"></i>
            </span>
          <span class="post-meta-item-text">阅读时长：</span>
           <span title="post.min2read">
                10 分钟
            </span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p><strong>Nginx 介绍及使用</strong></p>
<span id="more"></span>
<h3 id="1-简介"><a href="#1-简介" class="headerlink" title="1. 简介"></a>1. 简介</h3><ul>
<li><code>Nginx</code> （<code>engine x</code>）是一款轻量级的Web 服务器、反向代理服务器及电子邮件（<code>IMAP/POP3</code>）代理服务器。</li>
</ul>
<h4 id="1-1-正向代理、反向代理"><a href="#1-1-正向代理、反向代理" class="headerlink" title="1.1 正向代理、反向代理"></a>1.1 正向代理、反向代理</h4><ul>
<li><p>反向代理：</p>
<ul>
<li>是指以代理服务器来接收 <code>internet</code> 上的连接请求，然后将请求转发给内部网络上的服务器，并将从服务器上得到的结果返回给 <code>internet</code> 上请求连接的客户端，此时代理服务器对外就表现为一个反向代理服务器。</li>
</ul>
</li>
<li><p>正向代理：</p>
<ul>
<li>是一个位于客户端和原始服务器之间的服务器，为了从原始服务器取得内容，客户端向代理发送一个请求并指定目标，然后代理向原始服务器转交请求并获得的内容返回给客户端。客户端才能使用正向代理。 </li>
</ul>
</li>
</ul>
<h4 id="1-2-正向代理、反向代理区别"><a href="#1-2-正向代理、反向代理区别" class="headerlink" title="1.2 正向代理、反向代理区别"></a>1.2 正向代理、反向代理区别</h4><ul>
<li>正向代理，在客户端。比如需要访问某些国外网站，可能需要购买<code>vpn</code>。并且<code>vpn</code> 是在我们的用户浏览器端设置。工作原理：浏览器先访问<code>vpn</code>地址，<code>vpn</code>地址转发请求，并最后将请求结果原路返回。</li>
<li>反向代理是作用于服务器端，是一个虚拟的<code>ip</code>。工作原理：对于用户的一个请求，会转发到多个后端处理器中的一台来处理具体请求。</li>
</ul>
<h3 id="2-Nginx安装"><a href="#2-Nginx安装" class="headerlink" title="2. Nginx安装"></a>2. <code>Nginx</code>安装</h3><h4 id="2-1-Windows-安装"><a href="#2-1-Windows-安装" class="headerlink" title="2.1 Windows 安装"></a>2.1 <code>Windows</code> 安装</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># 官网：https://nginx.org/</span><br><span class="line"># 1. 下载nginx。 nginx/Windows-1.20.1</span><br><span class="line"># 2. 解压文件</span><br><span class="line"># 3. 进入目录，双击 nginx.exe</span><br></pre></td></tr></table></figure>
<h4 id="2-2-Linux-安装"><a href="#2-2-Linux-安装" class="headerlink" title="2.2 Linux 安装"></a>2.2 <code>Linux</code> 安装</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"># 1. 安装nginx 下载源</span><br><span class="line">rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm</span><br><span class="line"># nginx 源，能在/etc/yum.repos.d/目录有 nginx.repo文件</span><br><span class="line"># 2. yum 安装 nginx</span><br><span class="line">yum install nginx</span><br><span class="line"></span><br><span class="line"># 3. 常用命令</span><br><span class="line"># 查看运行状态</span><br><span class="line">systemctl status nginx</span><br><span class="line"># 运行nginx</span><br><span class="line">systemctl start nginx</span><br><span class="line"># 停止nginx</span><br><span class="line">systemctl stop nginx</span><br><span class="line"># 重启nginx</span><br><span class="line">systemctl restart nginx</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h4 id="2-2-常用命令"><a href="#2-2-常用命令" class="headerlink" title="2.2 常用命令"></a>2.2 常用命令</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"># 注：window 命令执行，需要携带 .exe。如：./nginx.exe -s stop</span><br><span class="line"># 启动nginx</span><br><span class="line">start nginx</span><br><span class="line"># 快速关闭nginx，可能不保存相关信息，并迅速终止web服务</span><br><span class="line">nginx -s stop</span><br><span class="line"># 平稳关闭nginx，保存相关信息，有安排的结束web服务</span><br><span class="line">nginx -s quit</span><br><span class="line"># nginx 配置改变，重新加载配置</span><br><span class="line">nginx -s reload</span><br><span class="line"># 重新打开日志文件</span><br><span class="line">nginx -s reopen</span><br><span class="line"># 为nginx指定一个配置文件，来代替缺省</span><br><span class="line">nginx -c filename</span><br><span class="line"># 不运行，而仅仅测试配置文件，将检查配置文件的语法的正确性，并尝试打开配置文件中所引用的文件</span><br><span class="line">nginx -t</span><br><span class="line"># 显示 nginx 版本</span><br><span class="line">nginx -v</span><br><span class="line"># 显示 nginx 版本，编译器版本和配置参数</span><br><span class="line">nginx -V</span><br></pre></td></tr></table></figure>
<h3 id="3-nginx-conf-配置文件"><a href="#3-nginx-conf-配置文件" class="headerlink" title="3. nginx.conf 配置文件"></a>3. <code>nginx.conf</code> 配置文件</h3><h4 id="3-1-全局块配置"><a href="#3-1-全局块配置" class="headerlink" title="3.1 全局块配置"></a>3.1 全局块配置</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"># 运行用户</span><br><span class="line">#user  nobody;</span><br><span class="line"># 启动进程，通常设置成和cpu的数量相等</span><br><span class="line">worker_processes  1;</span><br><span class="line">  </span><br><span class="line"># 全局错误日志及PID文件</span><br><span class="line">#error_log  logs/error.log;</span><br><span class="line"># 指定日志路径，级别</span><br><span class="line"># 日志级别：debug|info|notice|warn|error|crit|alert|emerg</span><br><span class="line">#error_log  logs/error.log  notice;</span><br><span class="line">#error_log  logs/error.log  info;</span><br><span class="line"># 指定nginx 进程运行文件存放地址</span><br><span class="line">#pid        logs/nginx.pid;</span><br></pre></td></tr></table></figure>
<h4 id="3-2-event-块配置"><a href="#3-2-event-块配置" class="headerlink" title="3.2 event 块配置"></a>3.2 <code>event</code> 块配置</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"># event块：配置影响nginx服务器与用户的网络连接。每个进程的最大连接数，选取哪种时间驱动模型处理连接请求，是否允许同时接受多个网络连接，开启多个网络连接序列化</span><br><span class="line"># 设置网络连接序列化，防止惊群现象发生，默认on</span><br><span class="line">accept_mutex on;</span><br><span class="line"># 设置一个进程是否同时接受多个网络连接，默认off</span><br><span class="line">multi_accept on;</span><br><span class="line"># 事件驱动模型。select|poll|kqueue|epoll|resig|/dev/poll|eventport</span><br><span class="line">use epoll;</span><br><span class="line"># 最大连接数</span><br><span class="line">worker_connections 1024;</span><br></pre></td></tr></table></figure>
<h4 id="3-3-http-块配置"><a href="#3-3-http-块配置" class="headerlink" title="3.3 http 块配置"></a>3.3 <code>http</code> 块配置</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line"># 配置nginx支持哪些文件扩展名与文件类型映射，具体支持类型在--&gt; conf/types</span><br><span class="line">include       mime.types;</span><br><span class="line"># 默认的文件类型，支持很多文件、图片、js/css</span><br><span class="line">   default_type  application/octet-stream;</span><br><span class="line">   </span><br><span class="line"># 自定义格式</span><br><span class="line">   #log_format  main  &#x27;$remote_addr - $remote_user [$time_local] &quot;$request&quot; &#x27;</span><br><span class="line">   #                  &#x27;$status $body_bytes_sent &quot;$http_referer&quot; &#x27;</span><br><span class="line">   #                  &#x27;&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;&#x27;;</span><br><span class="line"></span><br><span class="line"># combined 为日志格式的默认值</span><br><span class="line">   #access_log  logs/access.log  main;</span><br><span class="line"></span><br><span class="line"># 优化参数，允许sendfile方式传输文件，开启高效传输模式</span><br><span class="line">   sendfile        on;</span><br><span class="line">   # 防止网络阻塞</span><br><span class="line">   #tcp_nopush     on;</span><br><span class="line"></span><br><span class="line">   #keepalive_timeout  0;</span><br><span class="line">   # 长连接超时时间（s）</span><br><span class="line">   keepalive_timeout  65;</span><br><span class="line"># 每个连接最大请求数</span><br><span class="line"># keepalive_requests 8192</span><br><span class="line"># 开启gzip压缩</span><br><span class="line">   #gzip  on;</span><br></pre></td></tr></table></figure>
<h5 id="3-3-1-http-连接"><a href="#3-3-1-http-连接" class="headerlink" title="3.3.1 http 连接"></a>3.3.1 <code>http</code> 连接</h5><ul>
<li>短连接：连接–&gt;传输数据–&gt;关闭连接。如：<code>http</code>是无状态的短连接，浏览器和服务器每进行一次<code>HTTP</code> 操作，就建立一次连接，但任务结束就中断连接。因为连接后接收了数据就断开，所以每次数据接收处理不会有联系；</li>
<li>长连接：连接–&gt;传输数据–&gt;保持连接–&gt;传输数据–&gt;……………–&gt;直到一方关闭连接，大多数情况是客户端关闭连接。长连接指建立SOCKET连接后不管是否使用都保持连接，但是安全性较差。</li>
<li><code>HTTP/1.0</code> 默认使用短连接，<code>HTTP/1.1</code> 默认使用长连接</li>
</ul>
<h4 id="3-4-server-块配置"><a href="#3-4-server-块配置" class="headerlink" title="3.4 server 块配置"></a>3.4 <code>server</code> 块配置</h4><h5 id="3-4-1第一部分"><a href="#3-4-1第一部分" class="headerlink" title="3.4.1第一部分"></a>3.4.1第一部分</h5><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br></pre></td><td class="code"><pre><span class="line"># 配置虚拟主机</span><br><span class="line">server &#123;</span><br><span class="line">	# 配置监听端口</span><br><span class="line">    listen       80;</span><br><span class="line">    # 配置服务器名</span><br><span class="line">    server_name  localhost;</span><br><span class="line">	# 编码格式</span><br><span class="line">    #charset koi8-r;</span><br><span class="line">	# 主机访问日志（如没有，全局为准）</span><br><span class="line">    #access_log  logs/host.access.log  main;</span><br><span class="line">	# 默认匹配/请求，当访问路径中有/，会被该location匹配处理</span><br><span class="line">    location / &#123;</span><br><span class="line">     # root 是匹配服务器的默认网站根目录位置，在nginx 目录下html</span><br><span class="line">        root   html;</span><br><span class="line">        index  index.html index.htm;</span><br><span class="line">    &#125;</span><br><span class="line">	# 配置404页面</span><br><span class="line">    #error_page  404              /404.html;</span><br><span class="line"></span><br><span class="line">    # redirect server error pages to the static page /50x.html</span><br><span class="line">    #</span><br><span class="line">    # 配置50x页面</span><br><span class="line">    error_page   500 502 503 504  /50x.html;</span><br><span class="line">    # 精准匹配</span><br><span class="line">    location = /50x.html &#123;</span><br><span class="line">        root   html;</span><br><span class="line">    &#125;</span><br><span class="line">    </span><br><span class="line">	# 将 PHP 脚本代理到 Apache 监听 127.0.0.1:80</span><br><span class="line">    # proxy the PHP scripts to Apache listening on 127.0.0.1:80</span><br><span class="line">    #</span><br><span class="line">    #location ~ \.php$ &#123;</span><br><span class="line">    #    proxy_pass   http://127.0.0.1;</span><br><span class="line">    #&#125;</span><br><span class="line"></span><br><span class="line">	# 将 PHP 脚本传递给侦听 127.0.0.1:9000 的 FastCGI 服务器</span><br><span class="line">    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000</span><br><span class="line">    #</span><br><span class="line">    #location ~ \.php$ &#123;</span><br><span class="line">    #    root           html;</span><br><span class="line">    #    fastcgi_pass   127.0.0.1:9000;</span><br><span class="line">    #    fastcgi_index  index.php;</span><br><span class="line">    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;</span><br><span class="line">    #    include        fastcgi_params;</span><br><span class="line">    #&#125;</span><br><span class="line">	# 禁止（外网）访问 .htaccess文件</span><br><span class="line">    # deny access to .htaccess files, if Apache&#x27;s document root</span><br><span class="line">    # concurs with nginx&#x27;s one</span><br><span class="line">    #</span><br><span class="line">    #location ~ /\.ht &#123;</span><br><span class="line">    #    deny  all;</span><br><span class="line">    #&#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h5 id="3-4-2-第二部分"><a href="#3-4-2-第二部分" class="headerlink" title="3.4.2 第二部分"></a>3.4.2 第二部分</h5><ul>
<li>与第一部分类似，可以配置另一个虚拟机信息</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"># another virtual host using mix of IP-, name-, and port-based configuration</span><br><span class="line">#</span><br><span class="line">#server &#123;</span><br><span class="line">#    listen       8000;</span><br><span class="line">#    listen       somename:8080;</span><br><span class="line">#    server_name  somename  alias  another.alias;</span><br><span class="line"></span><br><span class="line">#    location / &#123;</span><br><span class="line">#        root   html;</span><br><span class="line">#        index  index.html index.htm;</span><br><span class="line">#    &#125;</span><br><span class="line">#&#125;</span><br></pre></td></tr></table></figure>
<h5 id="3-4-3-第三部分"><a href="#3-4-3-第三部分" class="headerlink" title="3.4.3 第三部分"></a>3.4.3 第三部分</h5><ul>
<li>配置 <code>https</code> 服务</li>
<li><code>HTTP</code>: 是互联网上应用最为广泛的一种网络协议，是一个客户端和服务端请求的应答的标准（<code>TCP</code>），用于从<code>www</code>服务器传输超文本到本地浏览器的传输协议，可以使浏览器更加高效，使网络传输减少。</li>
<li><code>HTTPS</code>: 是以安全为目标的<code>HTTP</code> 通道，简单讲是<code>HTTP</code> 的安全版。即<code>HTTPS = HTTP + SSL</code>，因此加密的详细内容需要<code>SSL</code>。<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"># HTTPS server</span><br><span class="line">#</span><br><span class="line">#server &#123;</span><br><span class="line"># 监听端口</span><br><span class="line">#    listen       443 ssl;</span><br><span class="line"># 域名，网址</span><br><span class="line">#    server_name  localhost;</span><br><span class="line"></span><br><span class="line"># 密钥</span><br><span class="line">#    ssl_certificate      cert.pem;</span><br><span class="line">#    ssl_certificate_key  cert.key;</span><br><span class="line"></span><br><span class="line">#    ssl_session_cache    shared:SSL:1m;</span><br><span class="line">#    ssl_session_timeout  5m;</span><br><span class="line"></span><br><span class="line">#    ssl_ciphers  HIGH:!aNULL:!MD5;</span><br><span class="line">#    ssl_prefer_server_ciphers  on;</span><br><span class="line"></span><br><span class="line">#    location / &#123;</span><br><span class="line">#        root   html;</span><br><span class="line">#        index  index.html index.htm;</span><br><span class="line">#    &#125;</span><br><span class="line">#&#125;</span><br></pre></td></tr></table></figure>
<h4 id="3-5-静态资源配置"><a href="#3-5-静态资源配置" class="headerlink" title="3.5 静态资源配置"></a>3.5 静态资源配置</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">location path &#123;</span><br><span class="line">	root static_path;</span><br><span class="line">	# alias static_path;</span><br><span class="line">&#125;</span><br><span class="line"># root 与 alias 区别</span><br><span class="line"># root: 是在 static_path/path 下找静态文件，对应的url 地址: http://IP:PORT/path/img/aa.png</span><br><span class="line"># alias: 是在 static_path 下找静态文件，对应的url 地址: http://IP:PORT/path/img/aa.png</span><br><span class="line">###########################################</span><br><span class="line"># 例：静态资源在 /home/test_nginx/static</span><br><span class="line">root 配置:</span><br><span class="line">location /static/ &#123;</span><br><span class="line">    root /home/test_nginx/;</span><br><span class="line">&#125;</span><br><span class="line">访问网址：http://192.168.238.131:8000/static/images/wx.jpg</span><br><span class="line">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><br><span class="line">alias 配置:</span><br><span class="line">location /static/ &#123;</span><br><span class="line">    alias /home/test_nginx/static/;</span><br><span class="line">    autoindex on;</span><br><span class="line">&#125;</span><br><span class="line">访问网址：http://192.168.238.131:8000/static/images/wx.jpg</span><br></pre></td></tr></table></figure>
<h4 id="3-6-反向代理"><a href="#3-6-反向代理" class="headerlink" title="3.6 反向代理"></a>3.6 反向代理</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">location / &#123;</span><br><span class="line">	proxy_pass http://IP:PORT;</span><br><span class="line">&#125;</span><br><span class="line"># proxy_pass 表示代理路径，相当于转发。指定网址，当用户访问指定网址时，会自动跳到代理路径</span><br><span class="line"># nginx 对 location 访问优先是以精确优先为原则，故将精细的请求放在前面，这样可以完成基本的动静分离</span><br></pre></td></tr></table></figure></li>
</ul>
<h4 id="3-7-动静分离"><a href="#3-7-动静分离" class="headerlink" title="3.7 动静分离"></a>3.7 动静分离</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">location ~ \.jsp$&#123;</span><br><span class="line">	proxy_pass http://IP:PORT;</span><br><span class="line">&#125;</span><br><span class="line">location ~ \.(js|css|png|jpg)$&#123;</span><br><span class="line">	root /home/test_nginx/static/</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="4-集群介绍"><a href="#4-集群介绍" class="headerlink" title="4. 集群介绍"></a>4. 集群介绍</h3><ul>
<li>高并发：系统通过专门的设计，同时指定多个请求访问能力；</li>
<li>高可用：减少停工时间，保障其服务的高度可用；</li>
<li>高性能：在高并发情况下，系统相应时间不会急剧增加。</li>
</ul>
<p>解决高并发、高可用—&gt;集群。</p>
<ul>
<li>集群：将统一业务，部署在多台服务器上，对外提供相同的业务；</li>
<li>分布式：部署到不同的服务器上，每个服务器上处理不同的业务员；</li>
<li>微服务：将一个大的业务，按功能拆分成互不相干的多个子业务，每个业务可独立部署。</li>
</ul>
<h3 id="5-负载均衡"><a href="#5-负载均衡" class="headerlink" title="5. 负载均衡"></a>5. 负载均衡</h3><ul>
<li>负载均衡是高可用网络架构的一个关键组成成分，可以将我们的应用服务器部署多台，然后通过负载均衡将用户请求分发到不同的服务器上，提高网站、应用、数据库或其他服务的性能已经可靠性。</li>
</ul>
<p><strong>负载均衡</strong>：</p>
<ul>
<li><p>轮询（默认）</p>
<ul>
<li>每个请求按时间顺序逐一分配到不同的后端服务器，如果服务器down，会自动剔除。<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">upstream backserver &#123;</span><br><span class="line">	server 192.168.0.1;</span><br><span class="line">	server 192.168.0.2;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></li>
</ul>
</li>
<li><p>指定权重</p>
<ul>
<li>指定轮询几率，weight 和 访问比率成正比，用于后端服务器性能不均的情况。<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">upstream backserver &#123;</span><br><span class="line">	server 192.168.0.1 weight=10;</span><br><span class="line">	server 192.168.0.2 weight=20;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></li>
</ul>
</li>
<li><p><code>ip_hash</code></p>
<ul>
<li><code>ip_hash</code>。每个请求按访问<code>ip</code>的 <code>hash</code> 值分配，这样同一客户端连接的<code>web</code>请求都会分发到同一服务器进行处理，可以解决<code>session</code> 的问题。当后台服务器宕机时，会自动跳转到其他服务器。<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">upstream backserver &#123;</span><br><span class="line">	ip_hash;</span><br><span class="line">	server 192.168.0.1;</span><br><span class="line">	server 192.168.0.2;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure></li>
</ul>
</li>
<li><p><code>url_hash</code>（第三方）</p>
<ul>
<li><code>url_hash</code> 是 <code>nginx</code> 的第三方模块，<code>nginx</code> 本身不支持，需要打补丁。</li>
<li><code>nginx</code> 按访问<code>url</code> 结果来分配请求，是每个<code>url</code> 定向到同一后端服务器，后端服务器为缓存服务器、文件服务器、静态服务器时比较有效。缺点：当后端服务器宕机时，<code>url_hash</code> 不会自动跳转其他缓存服务器，而是返回给用户一个503错误。</li>
</ul>
</li>
<li><p><code>fair</code> （第三方）</p>
<ul>
<li>按后端服务器的相应时间来分配请求，响应时间短的优先分配。</li>
</ul>
</li>
</ul>

    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>XiaoPang
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://zhangyh.fun/2021/08/26/Nginx%20%E4%BB%8B%E7%BB%8D/" title="Nginx 介绍及使用">https://zhangyh.fun/2021/08/26/Nginx 介绍/</a>
    <span class="copy-path"  title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="https://zhangyh.fun/2021/08/26/Nginx%20%E4%BB%8B%E7%BB%8D/"  aria-label="复制成功！"></i></span>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>
<script>
    var clipboard = new Clipboard('.fa-clipboard');
      $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({
          title: "",
          text: '复制成功',
          icon: "success",
          showConfirmButton: true
          });
        });
    });
</script>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/nginx1/" rel="tag"><i class="fa fa-tag"></i> nginx1</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2021/08/25/797.%20%E6%89%80%E6%9C%89%E5%8F%AF%E8%83%BD%E7%9A%84%E8%B7%AF%E5%BE%84/" rel="prev" title="797. 所有可能的路径">
      <i class="fa fa-chevron-left"></i> 797. 所有可能的路径
    </a></div>
      <div class="post-nav-item">
    <a href="/2021/08/31/1109.%20%E8%88%AA%E7%8F%AD%E9%A2%84%E8%AE%A2%E7%BB%9F%E8%AE%A1/" rel="next" title="1109. 航班预订统计">
      1109. 航班预订统计 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    

  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-%E7%AE%80%E4%BB%8B"><span class="nav-number">1.</span> <span class="nav-text">1. 简介</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#1-1-%E6%AD%A3%E5%90%91%E4%BB%A3%E7%90%86%E3%80%81%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86"><span class="nav-number">1.1.</span> <span class="nav-text">1.1 正向代理、反向代理</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#1-2-%E6%AD%A3%E5%90%91%E4%BB%A3%E7%90%86%E3%80%81%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E5%8C%BA%E5%88%AB"><span class="nav-number">1.2.</span> <span class="nav-text">1.2 正向代理、反向代理区别</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-Nginx%E5%AE%89%E8%A3%85"><span class="nav-number">2.</span> <span class="nav-text">2. Nginx安装</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-1-Windows-%E5%AE%89%E8%A3%85"><span class="nav-number">2.1.</span> <span class="nav-text">2.1 Windows 安装</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-Linux-%E5%AE%89%E8%A3%85"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 Linux 安装</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-2-%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="nav-number">2.3.</span> <span class="nav-text">2.2 常用命令</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-nginx-conf-%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="nav-number">3.</span> <span class="nav-text">3. nginx.conf 配置文件</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#3-1-%E5%85%A8%E5%B1%80%E5%9D%97%E9%85%8D%E7%BD%AE"><span class="nav-number">3.1.</span> <span class="nav-text">3.1 全局块配置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-2-event-%E5%9D%97%E9%85%8D%E7%BD%AE"><span class="nav-number">3.2.</span> <span class="nav-text">3.2 event 块配置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-3-http-%E5%9D%97%E9%85%8D%E7%BD%AE"><span class="nav-number">3.3.</span> <span class="nav-text">3.3 http 块配置</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#3-3-1-http-%E8%BF%9E%E6%8E%A5"><span class="nav-number">3.3.1.</span> <span class="nav-text">3.3.1 http 连接</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-4-server-%E5%9D%97%E9%85%8D%E7%BD%AE"><span class="nav-number">3.4.</span> <span class="nav-text">3.4 server 块配置</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#3-4-1%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86"><span class="nav-number">3.4.1.</span> <span class="nav-text">3.4.1第一部分</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#3-4-2-%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86"><span class="nav-number">3.4.2.</span> <span class="nav-text">3.4.2 第二部分</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#3-4-3-%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86"><span class="nav-number">3.4.3.</span> <span class="nav-text">3.4.3 第三部分</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-5-%E9%9D%99%E6%80%81%E8%B5%84%E6%BA%90%E9%85%8D%E7%BD%AE"><span class="nav-number">3.5.</span> <span class="nav-text">3.5 静态资源配置</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-6-%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86"><span class="nav-number">3.6.</span> <span class="nav-text">3.6 反向代理</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#3-7-%E5%8A%A8%E9%9D%99%E5%88%86%E7%A6%BB"><span class="nav-number">3.7.</span> <span class="nav-text">3.7 动静分离</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-%E9%9B%86%E7%BE%A4%E4%BB%8B%E7%BB%8D"><span class="nav-number">4.</span> <span class="nav-text">4. 集群介绍</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#5-%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1"><span class="nav-number">5.</span> <span class="nav-text">5. 负载均衡</span></a></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="XiaoPang"
      src="/images/avatar.gif">
  <p class="site-author-name" itemprop="name">XiaoPang</p>
  <div class="site-description" itemprop="description">少说，多做</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">34</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">11</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">19</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/zhang123-123" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;zhang123-123" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="/1741290057@qq.com" title="E-Mail → 1741290057@qq.com"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>
  <div class="cc-license motion-element" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>


<!-- CloudCalendar -->
<div class="widget-wrap" style="width: 90%;margin-left: auto;margin-right: auto; opacity: 0.97;">
	<div class="widget" id="CloudCalendar"></div>
</div>
      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">XiaoPang</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  

  
    <script type="text/javascript" color="0,0,0" opacity='0.5' zIndex="-2" count="200" src="/js/my_js/canvas-nest.min.js"></script>
    

</body>
<!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/my_js/clicklove.js"></script>

<!-- calendar widget -->

    <script src="/lib/calendar/calendar.min.js"></script>
    <script src="/lib/calendar/languages.min.js"></script>
    <script type="text/javascript">
    $(function() {
        $('#CloudCalendar').aCalendar('zh-CN',
            $.extend(
                '', {
                    single:true,
                    root:'/calendar/'
                }
            )
        );
    });
    </script>


</html>
